package com.zys.el.user.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zys.el.core.service.impl.CrudServiceImpl;
import com.zys.el.user.po.Note;
import com.zys.el.user.service.INoteService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NoteServiceImpl extends CrudServiceImpl<Note> implements INoteService {
    @Override
    public Integer getNoteCount(Long id) {
        QueryWrapper<Note> userQueryWrapper = new QueryWrapper<>();
        userQueryWrapper.eq("author_id_", id);
        return this.baseMapper.selectCount(userQueryWrapper);
    }

    @Override
    public List<Note> getNOteList(Long id) {
        QueryWrapper<Note> userQueryWrapper = new QueryWrapper<>();
        userQueryWrapper.eq("author_id_", id);
        return this.baseMapper.selectList(userQueryWrapper);
    }

    @Override
    public List<Note> getListHaveDelete() {
        QueryWrapper<Note> noteQueryWrapper = new QueryWrapper<>();
        noteQueryWrapper.eq("delete_", 0);
        return this.baseMapper.selectList(noteQueryWrapper);
    }
}
